{% extends '::base.html.twig' %}
{% block body %}
    {% block header %}
        <header>
            <div class="navbar navbar-default navbar-static-top" role="navigation">
                <div class="container">
                    <div class="navbar-header">
                        <a class="navbar-brand" href="{{ path('cms_index') }}">
                            Symfony Demo
                        </a>

                        <button type="button" class="navbar-toggle"
                                data-toggle="collapse"
                                data-target=".navbar-collapse">
                            <span class="sr-only">Toggle navigation</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                    </div>
                    <div class="navbar-collapse collapse">
                        <ul class="nav navbar-nav navbar-right">

                            {% block header_navigation_links %}
                                <li>
                                    <a href="{{ path('cms_index') }}">
                                        <i class="fa fa-home"></i> {{ '首页'|trans }}
                                    </a>
                                </li>

                                {# The 'app.user' condition is required to avoid issues in 404 and 500 error pages
                                   As routing is done before security, error pages are not covered by any firewall.
                                   This means you can't use is_granted() directly on these pages.
                                   See http://symfony.com/doc/current/cookbook/security/form_login_setup.html#avoid-common-pitfalls
                                #}
                                {% if app.user and is_granted('ROLE_ADMIN') %}
                                    <li>
                                        <a href="{{ path('admin_post_index') }}">
                                            <i class="fa fa-lock"></i> {{ 'menu.admin'|trans }}
                                        </a>
                                    </li>
                                {% endif %}
                            {% endblock %}

                            {% if app.user %}
                                <li>
                                    <a href="{{ path('security_logout') }}">
                                        <i class="fa fa-sign-out"></i> {{ 'menu.logout'|trans }}
                                    </a>
                                </li>
                            {% endif %}
                        </ul>
                    </div>
                </div>
            </div>
        </header>
    {% endblock %}

    <div class="container body-container">
        <div class="row">
            {% block main %}
            {% endblock %}
        </div>
    </div>

    {% block footer %}
        <footer>
            <div class="container">
                <div class="row">
                    <div id="footer-copyright" class="col-md-6">
                        <p>&copy; {{ 'now'|date('Y') }} - The Symfony Project</p>
                        <p>{{ 'mit_license'|trans }}</p>
                    </div>
                    <div id="footer-resources" class="col-md-6">
                        <p>
                            <a href="https://twitter.com/symfony"><i class="fa fa-twitter"></i></a>
                            <a href="https://www.facebook.com/SensioLabs"><i class="fa fa-facebook"></i></a>
                            <a href="http://symfony.com/blog"><i class="fa fa-rss"></i></a>
                        </p>
                    </div>
                </div>
            </div>
        </footer>
    {% endblock %}
{% endblock %}

{% block stylesheets %}
    {% stylesheets filter="scssphp,cssrewrite" output="css/compiled/main.css"
    "@SiteCmsBundle/Resources/public/scss/bootstrap.scss"
    "@SiteCmsBundle/Resources/public/scss/font-awesome.scss"
    "@SiteCmsBundle/Resources/public/css/*.css"
    "@SiteCmsBundle/Resources/public/scss/main.scss"
    %}
    <link rel="stylesheet" href="{{ asset_url }}"/>
    {% endstylesheets %}
{% endblock %}

{% block javascripts %}
    {% javascripts filter="?jsqueeze" output="js/compiled/main.js"
    "@SiteCmsBundle/Resources/public/js/jquery-2.1.4.js"
    "@SiteCmsBundle/Resources/public/js/moment.min.js"
    "@SiteCmsBundle/Resources/public/js/bootstrap-3.3.4.js"
    "@SiteCmsBundle/Resources/public/js/highlight.pack.js"
    "@SiteCmsBundle/Resources/public/js/bootstrap-datetimepicker.min.js"
    "@SiteCmsBundle/Resources/public/js/main.js"
    %}
    <script src="{{ asset_url }}"></script>
    {% endjavascripts %}
{% endblock %}

